Skip to content

feat(opencode): split opencode.jsonc into tracked default + runtime overlay (#4544) - #4554

Merged
dezren39 merged 1 commit into
mainfrom
chore/opencode-config-split
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
chore/opencode-config-split

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Closes #4544. Companion fork change: developing-today-forks/opencode#1429 (merged — Config.update writes into the explicit OPENCODE_CONFIG file when one is configured).

What

.opencode/opencode.jsonc was both the tracked, deliberate OpenCode configuration and the file bin/sync-models.mjs rewrites in place — the drift source behind the #4464 divergence. This splits it by ownership, using the fork server's native config layering (verified against the deployed build: config documents from multiple sources deep-merge per provider/model, and the OPENCODE_CONFIG source ranks above the global file and is watched for hot reload):

  • Tracked default (.opencode/opencode.jsonc) — deliberate config only. The five sync-owned providers (antigravity-direct, openai-codex, google, openai, cloudflare-gateway) lose their models maps (238 entries); shells stay; the models-only google/openai blocks disappear. Verified: the new file deep-equals the old file minus exactly those five maps.
  • Runtime overlay (~/.local/state/opencode/opencode-runtime.jsonc, untracked, machine-maintained) — holds only the five providers' models maps, moved verbatim. Migration proof: default + overlay deep-equals the pre-split effective config exactly.
  • bin/sync-models.mjs resolves the overlay first (env still wins), so the timer, the HM wrapper, and bare invocations maintain the overlay once it exists; the historical fallback chain is unchanged pre-split.
  • home/common/default.nix — the sync-models service is pinned to the overlay (OPENCODE_CONFIG_PATH); OPENCODE_CONFIG + OPENCODE_CONFIG_PATH join home.sessionVariables so the server, CLI invocations, and children inherit the layering across relaunches.
  • bin/opencode-route-proxy.mjs deep-merges the overlay over its config at load (OPENCODE_ROUTE_PROXY_RUNTIME_CONFIG, default the state path), cache keyed on both files — the proxy resolves the same effective catalog as the server.
  • bin/provider-catalog-sync.mjs diffs the merged effective config (--runtime-config, default the state path) and skips the five sync-owned providers on --apply — sync-models owns their writes. New tests pin the merge, the owned set, and the overlay diffing.
  • pm-stack aggregator — AA coverage and the catalog read the effective config (default + overlay) so the split costs no coverage parity.

Tests

  • node --test bin/sync-models.test.mjs bin/provider-catalog-sync.test.mjs bin/opencode-route-proxy.test.mjs — 63 pass (3 new overlay tests in catalog-sync).
  • bun test test/aa.test.ts (aggregator) — 42 pass.
  • home/common/default.nix parses; all edited scripts pass node --check.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…verlay (#4544)

The tracked .opencode/opencode.jsonc carried both the deliberate
configuration and the provider model catalogs bin/sync-models.mjs
rewrites in place \u2014 the drift source behind the #4464 divergence.
Split by ownership, using the fork server native OPENCODE_CONFIG
layering (companion: developing-today-forks/opencode#1429):

- .opencode/opencode.jsonc keeps deliberate config only: the five
  sync-owned providers (antigravity-direct, openai-codex, google,
  openai, cloudflare-gateway) lose their models maps (238 entries);
  shells stay, models-only google/openai blocks disappear. The maps
  move verbatim to ~/.local/state/opencode/opencode-runtime.jsonc
  (migration verified: default+overlay deep-equals the old file).
- bin/sync-models.mjs resolves the runtime overlay first, so the
  timer, the wrapper, and bare invocations all maintain the overlay
  once it exists; historical fallbacks unchanged pre-split.
- home/common/default.nix: sync-models service pinned to the overlay
  via OPENCODE_CONFIG_PATH; OPENCODE_CONFIG + OPENCODE_CONFIG_PATH in
  home.sessionVariables so the server and children inherit the layer.
- bin/opencode-route-proxy.mjs deep-merges the overlay over its
  config at load (OPENCODE_ROUTE_PROXY_RUNTIME_CONFIG), cache keyed
  on both files \u2014 the proxy resolves the same effective catalog.
- bin/provider-catalog-sync.mjs diffs the merged effective config
  (--runtime-config) and skips the five sync-owned providers on
  --apply; sync-models owns their writes.
- pm-stack aggregator: AA coverage + catalog read the effective
  config (default + overlay) so the split costs no coverage parity.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 20:01
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b64c4d33-e036-43c6-940a-1ba4479e4d2e
Commits

Reviewing files that changed from the base of the PR and between 6e12642 and f716822.

Files selected for processing: 8
  • .opencode/opencode.jsonc
  • bin/opencode-route-proxy.mjs
  • bin/provider-catalog-sync.mjs
  • bin/provider-catalog-sync.test.mjs
  • bin/sync-models.mjs
  • home/common/default.nix
  • pm-stack/aggregator/scripts/collect-fleet-feed.ts
  • pm-stack/aggregator/src/aa.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T20:02:36.867166Z f716822 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit e220845 into main Nov 2, 2026
2 checks passed
@dezren39
dezren39 deleted the chore/opencode-config-split branch November 2, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split opencode.jsonc into tracked configured default + runtime overlay (stop config drift)

1 participant